import spring.framework.beans.BeansException;
import spring.framework.beans.PropertyValue;
import spring.framework.beans.PropertyValues;
import spring.framework.beans.factory.ConfigurableListableBeanFactory;
import spring.framework.beans.factory.config.BeanDefinition;
import spring.framework.beans.factory.config.BeanFactoryPostProcessor;

/**
 * @author fun.pengzh
 * @class PACKAGE_NAME.MyBeanFactoryPostProcessor
 * @desc
 * @since 2021-09-30
 */
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {

        System.out.println("执行 postProcessBeanFactory");
        BeanDefinition beanDefinition =beanFactory.getBeanDefinition("userService");
        PropertyValues propertValues = beanDefinition.getPropertyValues();

        propertValues.addPropertyValue(new PropertyValue("company","改为 xxx 公司"));

    }
}
